package com.yl.chainStore.entity.warehouse

import com.baomidou.mybatisplus.annotation.IdType
import com.baomidou.mybatisplus.annotation.TableField
import com.baomidou.mybatisplus.annotation.TableId
import com.baomidou.mybatisplus.annotation.TableName
import com.yl.chainStore.common.enums.Status
import com.yl.common.annotation.NoArg

/**
 * <p>
 * 盘点明细
 * </p>
 *
 * @author cxw
 * @since 2021-06-10
 */
@NoArg
@TableName("warehouse_check_order_detail")
class WarehouseCheckOrderDetail(

    /**
     * 盘点明细
     */
    @TableId(value = "id", type = IdType.AUTO)
    var id: Long,

    /**
     * 订单id
     */
    @TableField("check_order_id")
    var checkOrderId: Long = -1,

    /**
     * 物品id
     */
    @TableField("item_id")
    var itemId: Long,

    @TableField(exist = false)
    var itemName: String? = null,

    @TableField(exist = false)
    var nickname: String? = null,

    @TableField(exist = false)
    var showLabel : String?= null,

    @TableField(exist = false)
    var unit: String? = null,

    @TableField(exist = false)
    var specification: String? = null,


    /**
     * 物品批次
     */
    @TableField("out_warehouse_good_batch_id")
    var outWarehouseGoodBatchId: Long? = null,

    /**
     * 盘点前数量
     */
    @TableField("before_count")
    var beforeCount: Int,

    /**
     * 盘点后数量
     */
    @TableField("after_count")
    var afterCount: Int,



    /**
     * 状态
     */
    @TableField("status")
    var status: Status = Status.UNKNOWN,

    /**
     * 数据有效性
     */
    @TableField("enabled")
    var enabled: Int = 1,

    /**
     * 备注
     */
    @TableField("remark")
    var remark: String? = null,
)  {
    /**
     * 差距数量（before - after）
     */
    @TableField("gap_count")
    var gapCount: Int = 0
        get() {
        return beforeCount - afterCount
    }
}
